package com.tools.ad.adscene.outer;

import com.hm.ads.sdk.HmAdsSDK;
import com.hm.adsbuisiness.bean.HmAdUnionPlace;
import com.hm.adsui.card.CommonNativeAdCardView;
import com.hm.base.android.mob.AMApplication;
import com.swipe.SwipeMgr;
import com.tools.ad.AdType;
import com.tools.ad.EntranceType;
import com.tools.ad.R;
import com.tools.ad.adscene.inner.CommonScene;
import com.tools.ad.ui.crad.view.CommonCardView;

/**
 * desc: 替换掉DAP 快滑的广告
 * date: 2018/4/20
 * author: ancun
 */

public class SwipeReplaceScene extends CommonScene {

    public SwipeReplaceScene(AMApplication context, EntranceType entranceType) {
        super(context, entranceType);
    }

    @Override
    public boolean load(boolean forceLoad) {
        HmAdUnionPlace adUnionPlace = HmAdsSDK.getInstance().getUnionAd(mEntranceType.getPid());
        if (adUnionPlace == null) {
            return false;
        }
        return loadUnionPlace(adUnionPlace);
    }

    @Override
    protected CommonNativeAdCardView initCardView() {
        return new CommonCardView(imContext);
    }

    @Override
    protected void onADLoaded(AdType adType) {
        imContext.handleMobEmptyMessage(R.id.msg_swipe_replace_ad_loaded);
    }

    @Override
    protected void onADClick(AdType adType) {
        super.onADClick(adType);
        SwipeMgr.getInstance().a(true);
    }
}
